package com.asiainfo.springcloud.manager;


import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 参照 {@link de.codecentric.boot.admin.config.NotifierConfiguration.HipchatNotifierConfiguration}实现一个发短信的
 */
@Configuration
public class NotifierConfiguration {

    @Configuration
    @ConditionalOnProperty(prefix = "spring.boot.admin.notify.sms", name = "enabled",havingValue = "true")
    //@AutoConfigureBefore({ de.codecentric.boot.admin.config.NotifierConfiguration.NotifierListenerConfiguration.class,
    //        de.codecentric.boot.admin.config.NotifierConfiguration.CompositeNotifierConfiguration.class })
    public static class SMSNotifierConfiguration {
        @Bean
        @ConditionalOnMissingBean
        @ConfigurationProperties("spring.boot.admin.notify.sms")
        public SMSNotifier smsNotifier() {
            return new SMSNotifier();
        }
    }
}
